using System;
using UnityEngine;
namespace Client.Base
{
    public class UniApp : MonoBehaviour
    {
        static public UniApp Instance { get; private set; }


        public Action onUpdate;
        public Action onDestroy;
        public Action<bool> onApplicationFocus;
        public Action<bool> onApplicationPause;

        private void Awake()
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        private void Update()
        {
            onUpdate?.Invoke();
        }
        private void OnApplicationFocus(bool focus)
        {
            onApplicationFocus?.Invoke(focus);
        }
        private void OnApplicationPause(bool pause)
        {
            onApplicationPause?.Invoke(pause);
        }
        private void OnDestroy()
        {
            onDestroy?.Invoke();
        }
    }

}
